//
//  OCMediator.h
//  OCMediator
//
//  Created by dafiger on 2020.04.14.
//  Copyright © 2020 dafiger. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface OCMediator : NSObject

+ (instancetype _Nonnull)sharedInstance;

// 远程App调用入口
- (id _Nullable)performActionWithUrl:(NSURL * _Nullable)url
                          completion:(void(^_Nullable)(NSDictionary * _Nullable info))completion;

// 本地组件调用入口
- (id _Nullable )performTarget:(NSString * _Nullable)targetName
                        action:(NSString * _Nullable)actionName
                        params:(NSDictionary * _Nullable)params
             shouldCacheTarget:(BOOL)shouldCacheTarget;
- (void)releaseCachedTargetWithFullTargetName:(NSString * _Nullable)fullTargetName;

#pragma mark - 自定义
- (id _Nullable)openURL:(NSString * _Nullable)urlStr
                    arg:(NSDictionary * _Nullable)params
      shouldCacheTarget:(BOOL)shouldCacheTarget
             completion:(void(^_Nullable)(NSDictionary * _Nullable info))completion;

@end
